<template>
  <div>
    <el-table :data="goodsList.resultList" style="width: 100%">
      <el-table-column type="index" label="Id"></el-table-column>
      <el-table-column prop="title" label="标题" width="180"></el-table-column>
      <el-table-column label="图片">
        <template slot-scope="scope">
          <el-image :src="scope.row.imgUrl"></el-image>
        </template>
      </el-table-column>
      <el-table-column label="价格">
        <template slot-scope="scope">
          渠道专属价：
          <span v-text="scope.row.channelPrice"></span>
          <br />原则：
          <span v-text="scope.row.price"></span>
          <br />超买价：
          <span v-text="scope.row.promotionPrice"></span>
        </template>
      </el-table-column>
      <el-table-column label="商品状态">
        <template slot-scope="scope">{{scope.row.invalid ? "已失效" : "有效"}}</template>
      </el-table-column>
      <el-table-column label="时间">
        <template slot-scope="scope">
          <span v-text="scope.row.createTime"></span>
        </template>
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button @click="$router.push({path: `/1688/shop/detail/${scope.row.feedId}`})">查看详情</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      background
      layout="prev, pager, next"
      :total="goodsList.totalRow"
      @current-change="handleCurrentChange"
    ></el-pagination>
  </div>
</template>

<script>
export default {
  name: "followList",
  data() {
    return { goodsList: {} };
  },
  methods: {
    handleCurrentChange(current) {
      this.getGroupList(current);
    },
    async getGroupList(current = 1) {
      await this.$http
        .post(
          `/select-goods/get-select-goods-list/${current}/${this.$route.params.id}`
        )
        .then((res) => {
          let message = JSON.parse(res.data.message).result;
          this.goodsList = message;
        });
    },
  },
  created() {
    this.getGroupList(1);
  },
};
</script>
